/*
 * @Description: 鉴权中间件 简单处理 判断是否登录
 * @Author: iamsmiling
 * @Date: 2021-06-16 07:17:11
 * @LastEditTime: 2021-06-16 07:18:38
 */

import 'package:credit_business_circle/storage/local_storage.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../app_routes.dart';

class AuthMiddleware extends GetMiddleware {
  @override
  int? priority = 9;

  ///重定向到登录页面
  @override
  RouteSettings? redirect(String? route) {
    return LocalStorage.read("token") != null
        ? null
        : RouteSettings(name: AppRoutes.login);
  }
}
